<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>

</html>
<script>

    //1.创建请求对象
    var xhr = new XMLHttpRequest()
    //2.配置请求函数
    xhr.open('get', 'https://yantianfeng.com/api/addressList')
    // xhr.open('get','https://gitee.com/lovezhoufangzun/day26')//不允许跨域
    //3.设置回调函数
    xhr.onreadystatechange = function () {
        if (xhr.readyState == 4) {
            // console.log(JSON.parse(xhr.responseText));
            console.log(xhr.responseText);
        }
    }
    //4.发送请求
    xhr.send()
</script>